diff --git a/.changeset/cuddly-dodos-report.md b/.changeset/cuddly-dodos-report.md new file mode 100644 index 0000000000..55c8a6cec2 --- /dev/null +++ b/.changeset/cuddly-dodos-report.md @@ -0,0 +1,6 @@ +--- +"@react-router/dev": patch +"react-router": patch +--- + +Move RSCHydratedRouter and utils to `/dom` export. diff --git a/integration/helpers/rsc-parcel/src/browser.tsx b/integration/helpers/rsc-parcel/src/browser.tsx index d0c02387d1..4f7e3d8dfe 100644 --- a/integration/helpers/rsc-parcel/src/browser.tsx +++ b/integration/helpers/rsc-parcel/src/browser.tsx @@ -2,12 +2,12 @@ import { startTransition, StrictMode } from "react"; import { hydrateRoot } from "react-dom/client"; -import type { unstable_RSCPayload as RSCPayload } from "react-router"; import { unstable_createCallServer as createCallServer, unstable_getRSCStream as getRSCStream, unstable_RSCHydratedRouter as RSCHydratedRouter, -} from "react-router"; + type unstable_RSCPayload as RSCPayload, +} from "react-router/dom"; import { createFromReadableStream, createTemporaryReferenceSet, diff --git a/integration/helpers/rsc-vite/src/entry.browser.tsx b/integration/helpers/rsc-vite/src/entry.browser.tsx index e45f8a4137..67182282f1 100644 --- a/integration/helpers/rsc-vite/src/entry.browser.tsx +++ b/integration/helpers/rsc-vite/src/entry.browser.tsx @@ -10,8 +10,8 @@ import { unstable_createCallServer as createCallServer, unstable_getRSCStream as getRSCStream, unstable_RSCHydratedRouter as RSCHydratedRouter, -} from "react-router"; -import type { unstable_RSCPayload as RSCPayload } from "react-router"; + type unstable_RSCPayload as RSCPayload, +} from "react-router/dom"; import { getContext } from "./config/get-context"; setServerCallback( diff --git a/packages/react-router-dev/config/default-rsc-entries/entry.client.tsx b/packages/react-router-dev/config/default-rsc-entries/entry.client.tsx index 1d85ca6e92..a1fef50d84 100644 --- a/packages/react-router-dev/config/default-rsc-entries/entry.client.tsx +++ b/packages/react-router-dev/config/default-rsc-entries/entry.client.tsx @@ -12,8 +12,8 @@ import { unstable_createCallServer as createCallServer, unstable_getRSCStream as getRSCStream, unstable_RSCHydratedRouter as RSCHydratedRouter, -} from "react-router"; -import type { unstable_RSCPayload as RSCPayload } from "react-router"; + type unstable_RSCPayload as RSCPayload, +} from "react-router/dom"; setServerCallback( createCallServer({ diff --git a/packages/react-router/dom-export.ts b/packages/react-router/dom-export.ts index 4b1e0a5c4d..b5602b7026 100644 --- a/packages/react-router/dom-export.ts +++ b/packages/react-router/dom-export.ts @@ -8,3 +8,19 @@ export type { RouterProviderProps } from "./lib/dom-export/dom-router-provider"; export { RouterProvider } from "./lib/dom-export/dom-router-provider"; export type { HydratedRouterProps } from "./lib/dom-export/hydrated-router"; export { HydratedRouter } from "./lib/dom-export/hydrated-router"; + +// RSC +export { + createCallServer as unstable_createCallServer, + RSCHydratedRouter as unstable_RSCHydratedRouter, +} from "./lib/rsc/browser"; +export { getRSCStream as unstable_getRSCStream } from "./lib/rsc/html-stream/browser"; + +export type { + DecodeActionFunction as unstable_DecodeActionFunction, + DecodeFormStateFunction as unstable_DecodeFormStateFunction, + DecodeReplyFunction as unstable_DecodeReplyFunction, + RSCManifestPayload as unstable_RSCManifestPayload, + RSCPayload as unstable_RSCPayload, + RSCRenderPayload as unstable_RSCRenderPayload, +} from "./lib/rsc/server.rsc"; diff --git a/packages/react-router/index.ts b/packages/react-router/index.ts index fe3c25cea6..0266deee06 100644 --- a/packages/react-router/index.ts +++ b/packages/react-router/index.ts @@ -297,10 +297,6 @@ export type { EncodeReplyFunction as unstable_EncodeReplyFunction, RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, } from "./lib/rsc/browser"; -export { - createCallServer as unstable_createCallServer, - RSCHydratedRouter as unstable_RSCHydratedRouter, -} from "./lib/rsc/browser"; export type { SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, RSCStaticRouterProps as unstable_RSCStaticRouterProps, @@ -309,7 +305,6 @@ export { routeRSCServerRequest as unstable_routeRSCServerRequest, RSCStaticRouter as unstable_RSCStaticRouter, } from "./lib/rsc/server.ssr"; -export { getRSCStream as unstable_getRSCStream } from "./lib/rsc/html-stream/browser"; export { RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary } from "./lib/rsc/errorBoundaries"; // Re-export of RSC types diff --git a/playground/rsc-parcel/src/entry.browser.tsx b/playground/rsc-parcel/src/entry.browser.tsx index 1c423855fb..a245bd4bea 100644 --- a/playground/rsc-parcel/src/entry.browser.tsx +++ b/playground/rsc-parcel/src/entry.browser.tsx @@ -6,8 +6,8 @@ import { unstable_createCallServer as createCallServer, unstable_getRSCStream as getRSCStream, unstable_RSCHydratedRouter as RSCHydratedRouter, -} from "react-router"; -import type { unstable_RSCPayload as RSCPayload } from "react-router"; + type unstable_RSCPayload as RSCPayload, +} from "react-router/dom"; import { createFromReadableStream, createTemporaryReferenceSet, diff --git a/playground/rsc-vite/src/entry.browser.tsx b/playground/rsc-vite/src/entry.browser.tsx index 3a9585d479..8e4f850b95 100644 --- a/playground/rsc-vite/src/entry.browser.tsx +++ b/playground/rsc-vite/src/entry.browser.tsx @@ -10,8 +10,8 @@ import { unstable_createCallServer as createCallServer, unstable_getRSCStream as getRSCStream, unstable_RSCHydratedRouter as RSCHydratedRouter, -} from "react-router"; -import type { unstable_RSCPayload as RSCPayload } from "react-router"; + type unstable_RSCPayload as RSCPayload, +} from "react-router/dom"; setServerCallback( createCallServer({