Skip to content

Commit

Permalink
chore: rename non public exports
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <logan@mcan.sh>
  • Loading branch information
mcansh committed Dec 16, 2022
1 parent 90a1634 commit 7e2cdf3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
1 change: 0 additions & 1 deletion packages/remix-react/components.tsx
Expand Up @@ -246,7 +246,6 @@ function Routes() {
// loader argument. But since we're just using <Router> we aren't using any
// loaders in RR so this isn't an issue. We'll get these typings straightened
// out as part of the rendering work.
// @ts-expect-error
let element = useRoutes(clientRoutes) || (clientRoutes[0].element as any);
return element;
}
Expand Down
16 changes: 11 additions & 5 deletions packages/remix-react/index.tsx
Expand Up @@ -35,7 +35,7 @@ export {
Link,
NavLink,
Form,
RemixEntry,
RemixEntry as UNSAFE_RemixEntry,
PrefetchPageLinks,
LiveReload,
useFormAction,
Expand All @@ -58,8 +58,8 @@ export type { HtmlLinkDescriptor } from "./links";
export type {
ShouldReloadFunction,
HtmlMetaDescriptor,
CatchBoundaryComponent,
RouteModules,
CatchBoundaryComponent as UNSAFE_CatchBoundaryComponent,
RouteModules as UNSAFE_RouteModules,
} from "./routeModules";

export { ScrollRestoration } from "./scroll-restoration";
Expand All @@ -69,6 +69,12 @@ export { RemixServer } from "./server";

export type { Fetcher } from "./transition";

export type { AssetsManifest, EntryContext } from "./entry";
export type {
AssetsManifest as UNSAFE_AssetsManifest,
EntryContext as UNSAFE_EntryContext,
} from "./entry";
export type { RouteData } from "./routeData";
export type { EntryRoute, RouteManifest } from "./routes";
export type {
EntryRoute as UNSAFE_EntryRoute,
RouteManifest as UNSAFE_RouteManifest,
} from "./routes";
32 changes: 17 additions & 15 deletions packages/remix-testing/create-remix-stub.tsx
@@ -1,13 +1,13 @@
import * as React from "react";
import type {
AssetsManifest,
EntryContext,
EntryRoute,
UNSAFE_AssetsManifest,
UNSAFE_EntryContext,
UNSAFE_EntryRoute,
RouteData,
RouteManifest,
RouteModules,
UNSAFE_RouteManifest,
UNSAFE_RouteModules,
} from "@remix-run/react";
import { RemixEntry } from "@remix-run/react";
import { UNSAFE_RemixEntry } from "@remix-run/react";
import type {
Action,
AgnosticDataRouteObject,
Expand Down Expand Up @@ -75,7 +75,7 @@ type NonIndexStubRouteObject = AgnosticNonIndexRouteObject & {
// TODO: once Remix is on RR@6.4 we can just use the native type
type StubRouteObject = IndexStubRouteObject | NonIndexStubRouteObject;

type RemixConfigFuture = Partial<EntryContext["future"]>;
type RemixConfigFuture = Partial<UNSAFE_EntryContext["future"]>;

export function createRemixStub(
routes: StubRouteObject[],
Expand Down Expand Up @@ -124,7 +124,7 @@ export function createRemixStub(
monkeyPatchFetch(queryRoute, dataRoutes);

return (
<RemixEntry
<UNSAFE_RemixEntry
context={remixContext}
action={state.action}
location={state.location}
Expand All @@ -140,7 +140,7 @@ function createRemixContext(
initialLoaderData?: RouteData,
initialActionData?: RouteData,
future?: RemixConfigFuture
): EntryContext {
): UNSAFE_EntryContext {
let manifest = createManifest(routes);
let matches = matchRoutes(routes, currentLocation) || [];

Expand All @@ -164,7 +164,9 @@ function createRemixContext(
};
}

function createManifest(routes: AgnosticDataRouteObject[]): AssetsManifest {
function createManifest(
routes: AgnosticDataRouteObject[]
): UNSAFE_AssetsManifest {
return {
routes: createRouteManifest(routes),
entry: { imports: [], module: "" },
Expand All @@ -175,9 +177,9 @@ function createManifest(routes: AgnosticDataRouteObject[]): AssetsManifest {

function createRouteManifest(
routes: AgnosticDataRouteObject[],
manifest?: RouteManifest<EntryRoute>,
manifest?: UNSAFE_RouteManifest<UNSAFE_EntryRoute>,
parentId?: string
): RouteManifest<EntryRoute> {
): UNSAFE_RouteManifest<UNSAFE_EntryRoute> {
return routes.reduce((manifest, route) => {
if (route.children) {
createRouteManifest(route.children, manifest, route.id);
Expand All @@ -189,8 +191,8 @@ function createRouteManifest(

function createRouteModules(
routes: AgnosticDataRouteObject[],
routeModules?: RouteModules
): RouteModules {
routeModules?: UNSAFE_RouteModules
): UNSAFE_RouteModules {
return routes.reduce((modules, route) => {
if (route.children) {
createRouteModules(route.children, modules);
Expand Down Expand Up @@ -247,7 +249,7 @@ function monkeyPatchFetch(
function convertToEntryRoute(
route: AgnosticDataRouteObject,
parentId?: string
): EntryRoute {
): UNSAFE_EntryRoute {
return {
id: route.id!,
index: route.index,
Expand Down

0 comments on commit 7e2cdf3

Please sign in to comment.