react-router 0.0.0-experimental-3bba3331c → 0.0.0-experimental-07f9b5e04

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v0.0.0-experimental-3bba3331c
2
+ * React Router v0.0.0-experimental-07f9b5e04
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -30,11 +30,11 @@ function _extends() {
30
30
  let ssrInfo = null;
31
31
  let router = null;
32
32
  function initSsrInfo() {
33
- if (!ssrInfo && window.__remixContext && window.__remixManifest && window.__remixRouteModules) {
33
+ if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
34
34
  ssrInfo = {
35
- context: window.__remixContext,
36
- manifest: window.__remixManifest,
37
- routeModules: window.__remixRouteModules,
35
+ context: window.__reactRouterContext,
36
+ manifest: window.__reactRouterManifest,
37
+ routeModules: window.__reactRouterRouteModules,
38
38
  stateDecodingPromise: undefined,
39
39
  router: undefined,
40
40
  routerInitialized: false
@@ -47,7 +47,7 @@ function createHydratedRouter() {
47
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
48
  }
49
49
  // We need to suspend until the initial state snapshot is decoded into
50
- // window.__remixContext.state
50
+ // window.__reactRouterContext.state
51
51
  let localSsrInfo = ssrInfo;
52
52
  // Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this
53
53
  // code potentially many times waiting for our state to arrive, but we'll
@@ -72,7 +72,7 @@ function createHydratedRouter() {
72
72
  let routes = UNSAFE_createClientRoutes(ssrInfo.manifest.routes, ssrInfo.routeModules, ssrInfo.context.state, ssrInfo.context.isSpaMode);
73
73
  let hydrationData = undefined;
74
74
  if (!ssrInfo.context.isSpaMode) {
75
- var _window$__remixContex;
75
+ var _window$__reactRouter;
76
76
  // Create a shallow clone of `loaderData` we can mutate for partial hydration.
77
77
  // When a route exports a `clientLoader` and a `HydrateFallback`, the SSR will
78
78
  // render the fallback so we need the client to do the same for hydration.
@@ -82,7 +82,7 @@ function createHydratedRouter() {
82
82
  hydrationData = _extends({}, ssrInfo.context.state, {
83
83
  loaderData: _extends({}, ssrInfo.context.state.loaderData)
84
84
  });
85
- let initialMatches = matchRoutes(routes, window.location, (_window$__remixContex = window.__remixContext) == null ? void 0 : _window$__remixContex.basename);
85
+ let initialMatches = matchRoutes(routes, window.location, (_window$__reactRouter = window.__reactRouterContext) == null ? void 0 : _window$__reactRouter.basename);
86
86
  if (initialMatches) {
87
87
  for (let match of initialMatches) {
88
88
  let routeId = match.route.id;
@@ -131,7 +131,7 @@ function createHydratedRouter() {
131
131
  // @ts-ignore
132
132
  router.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
133
133
  UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
134
- window.__remixRouter = router;
134
+ window.__reactRouterInstance = router;
135
135
  return router;
136
136
  }
137
137
  /**
@@ -148,7 +148,7 @@ function HydratedRouter() {
148
148
  let [criticalCss, setCriticalCss] = React.useState(process.env.NODE_ENV === "development" ? (_ssrInfo = ssrInfo) == null ? void 0 : _ssrInfo.context.criticalCss : undefined);
149
149
  if (process.env.NODE_ENV === "development") {
150
150
  if (ssrInfo) {
151
- window.__remixClearCriticalCss = () => setCriticalCss(undefined);
151
+ window.__reactRouterClearCriticalCss = () => setCriticalCss(undefined);
152
152
  }
153
153
  }
154
154
  let [location, setLocation] = React.useState(router.state.location);
@@ -1 +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,IA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AAAS,QAAA,EAAA,IAAA,CAAA,CAAA;AACJ,IAAA;AAEP;;AC/QM,SAAUK,cAAcA,CAACC,KAA6C,EAAA;AAC1E,EAAA,oBAAOf,KAAA,CAAAQ,aAAA,CAACQ,gBAAkB,EAAAjD,QAAA,CAAA;IAACkD,SAAS,EAAEC,QAAQ,CAACD,SAAAA;GAAeF,EAAAA,KAAK,CAAA,CAAI,CAAA;AACzE;;;;"}
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)[\"__reactRouterContext\"]>;\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.__reactRouterContext &&\n window.__reactRouterManifest &&\n window.__reactRouterRouteModules\n ) {\n ssrInfo = {\n context: window.__reactRouterContext,\n manifest: window.__reactRouterManifest,\n routeModules: window.__reactRouterRouteModules,\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.__reactRouterContext.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.__reactRouterContext?.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.__reactRouterInstance = 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.__reactRouterClearCriticalCss = () => 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","__reactRouterContext","__reactRouterManifest","__reactRouterRouteModules","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$__reactRouter","_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","__reactRouterInstance","HydratedRouter","_ssrInfo","criticalCss","setCriticalCss","React","useState","__reactRouterClearCriticalCss","setLocation","useLayoutEffect","subscribe","newState","useFogOFWarDiscovery","createElement","Fragment","FrameworkContext","Provider","future","RemixErrorBoundary","RouterProvider","props","BaseRouterProvider","flushSync","ReactDOM"],"mappings":";;;;;;;;;;;;;;;;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AQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,EAAA,IAAA,eACET,KAAA,CAAAQ,aAAA,CAACE,uBAAgB,CAACC,QAAQ,EAAA;AACxBtD,MAAAA,KAAK,EAAE;QACLf,QAAQ,EAAER,OAAO,CAACQ,QAAQ;QAC1BC,YAAY,EAAET,OAAO,CAACS,YAAY;AAClCqE,QAAAA,MAAM,EAAE9E,OAAO,CAACO,OAAO,CAACuE,MAAM;QAC9Bd,WAAW;AACXlC,QAAAA,SAAS,EAAE9B,OAAO,CAACO,OAAO,CAACuB,SAAAA;AAC5B,OAAA;AAAA,KAAA,eAEDoC,KAAA,CAAAQ,aAAA,CAACK,yBAAkB,EAAA;AAAC1C,MAAAA,QAAQ,EAAEA,QAAAA;AAAQ,KAAA,eACpC6B,KAAA,CAAAQ,aAAA,CAACM,cAAc,EAAC;AAAA/E,MAAAA,MAAM,EAAEA,MAAAA;AAAM,KAAA,CAAI,CACf,CACK,eAK5BiE,KAAK,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,EAAA,IAAA,CAAA,CAAA;AACJ,IAAA;AAEP;;AC/QM,SAAUK,cAAcA,CAACC,KAA6C,EAAA;AAC1E,EAAA,oBAAOf,KAAA,CAAAQ,aAAA,CAACQ,gBAAkB,EAAAjD,QAAA,CAAA;IAACkD,SAAS,EAAEC,QAAQ,CAACD,SAAAA;GAAeF,EAAAA,KAAK,CAAA,CAAI,CAAA;AACzE;;;;"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v0.0.0-experimental-3bba3331c
2
+ * React Router v0.0.0-experimental-07f9b5e04
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -6660,7 +6660,7 @@ async function loadRouteModule(route, routeModulesCache) {
6660
6660
  // Log the error so it can be accessed via the `Preserve Log` setting
6661
6661
  console.error("Error loading route module `" + route.module + "`, reloading page...");
6662
6662
  console.error(error);
6663
- if (window.__remixContext && window.__remixContext.isSpaMode &&
6663
+ if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode &&
6664
6664
  // @ts-expect-error
6665
6665
  typeof import.meta.hot !== "undefined") {
6666
6666
  // In SPA Mode (which implies vite) we don't want to perform a hard reload
@@ -6993,14 +6993,14 @@ function StreamTransfer(_ref) {
6993
6993
  let scriptTag = value ? ( /*#__PURE__*/React.createElement("script", {
6994
6994
  nonce: nonce,
6995
6995
  dangerouslySetInnerHTML: {
6996
- __html: "window.__remixContext.streamController.enqueue(" + escapeHtml$1(JSON.stringify(value)) + ");"
6996
+ __html: "window.__reactRouterContext.streamController.enqueue(" + escapeHtml$1(JSON.stringify(value)) + ");"
6997
6997
  }
6998
6998
  })) : null;
6999
6999
  if (done) {
7000
7000
  return /*#__PURE__*/React.createElement(React.Fragment, null, scriptTag, /*#__PURE__*/React.createElement("script", {
7001
7001
  nonce: nonce,
7002
7002
  dangerouslySetInnerHTML: {
7003
- __html: "window.__remixContext.streamController.close();"
7003
+ __html: "window.__reactRouterContext.streamController.close();"
7004
7004
  }
7005
7005
  }));
7006
7006
  } else {
@@ -7155,7 +7155,7 @@ async function singleFetchLoaderNavigationStrategy(manifest, routeModules, route
7155
7155
  // One exception - if we are performing an HDR revalidation we have to call
7156
7156
  // the server in case a new loader has shown up that the manifest doesn't yet
7157
7157
  // know about
7158
- if ((!router.state.initialized || routesParams.size === 0) && !window.__remixHdrActive) {
7158
+ if ((!router.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
7159
7159
  singleFetchDfd.resolve({});
7160
7160
  } else {
7161
7161
  try {
@@ -8490,10 +8490,10 @@ function Scripts(props) {
8490
8490
  }, []);
8491
8491
  let initialScripts = React.useMemo(() => {
8492
8492
  var _manifest$hmr;
8493
- let streamScript = "window.__remixContext.stream = new ReadableStream({" + "start(controller){" + "window.__remixContext.streamController = controller;" + "}" + "}).pipeThrough(new TextEncoderStream());";
8494
- let contextScript = staticContext ? "window.__remixContext = " + serverHandoffString + ";" + streamScript : " ";
8493
+ let streamScript = "window.__reactRouterContext.stream = new ReadableStream({" + "start(controller){" + "window.__reactRouterContext.streamController = controller;" + "}" + "}).pipeThrough(new TextEncoderStream());";
8494
+ let contextScript = staticContext ? "window.__reactRouterContext = " + serverHandoffString + ";" + streamScript : " ";
8495
8495
  let routeModulesScript = !isStatic ? " " : "" + ((_manifest$hmr = manifest.hmr) != null && _manifest$hmr.runtime ? "import " + JSON.stringify(manifest.hmr.runtime) + ";" : "") + (!enableFogOfWar ? "import " + JSON.stringify(manifest.url) : "") + ";\n" + matches.map((match, index) => "import * as route" + index + " from " + JSON.stringify(manifest.routes[match.route.id].module) + ";").join("\n") + "\n " + (enableFogOfWar ? // Inline a minimal manifest with the SSR matches
8496
- "window.__remixManifest = " + JSON.stringify(getPartialManifest(manifest, router), null, 2) + ";" : "") + "\n window.__remixRouteModules = {" + matches.map((match, index) => JSON.stringify(match.route.id) + ":route" + index).join(",") + "};\n\nimport(" + JSON.stringify(manifest.entry.module) + ");";
8496
+ "window.__reactRouterManifest = " + JSON.stringify(getPartialManifest(manifest, router), null, 2) + ";" : "") + "\n window.__reactRouterRouteModules = {" + matches.map((match, index) => JSON.stringify(match.route.id) + ":route" + index).join(",") + "};\n\nimport(" + JSON.stringify(manifest.entry.module) + ");";
8497
8497
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("script", _extends({}, props, {
8498
8498
  suppressHydrationWarning: true,
8499
8499
  dangerouslySetInnerHTML: createHtml(contextScript),
@@ -10667,7 +10667,7 @@ function createServerHandoffString(serverHandoff) {
10667
10667
  return escapeHtml(JSON.stringify(serverHandoff));
10668
10668
  }
10669
10669
 
10670
- const globalDevServerHooksKey = "__remix_devServerHooks";
10670
+ const globalDevServerHooksKey = "__reactRouterDevServerHooks";
10671
10671
  function setDevServerHooks(devServerHooks) {
10672
10672
  // @ts-expect-error
10673
10673
  globalThis[globalDevServerHooksKey] = devServerHooks;