From 210d09e4c60e66dc65f3fb2f32079e6f19c4cba4 Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Fri, 18 Oct 2024 14:19:41 +1100 Subject: [PATCH] Rename routes option adapter function --- docs/start/future-flags.md | 14 +++++++------- integration/vite-fs-routes-test.ts | 4 ++-- packages/remix-routes-option-adapter/index.ts | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/start/future-flags.md b/docs/start/future-flags.md index 2ca6fb6523b..4afc75967c4 100644 --- a/docs/start/future-flags.md +++ b/docs/start/future-flags.md @@ -537,16 +537,16 @@ npm install --dev @remix-run/routes-option-adapter This package matches the API of React Router v7's `@react-router/remix-route-config-adapter`, making the React Router v7 migration as easy as possible. -Then, update your `routes.ts` file to use the adapter, passing the value of your `routes` option to the `routesOptionAdapter` function which will return an array of configured routes. +Then, update your `routes.ts` file to use the adapter, passing the value of your `routes` option to the `remixRoutesOptionAdapter` function which will return an array of configured routes. For example, if you were using the `routes` option to use an alternative file system routing implementation like [remix-flat-routes]: ```ts filename=app/routes.ts import { type RouteConfig } from "@remix-run/route-config"; -import { routesOptionAdapter } from "@remix-run/routes-option-adapter"; +import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter"; import { flatRoutes } from "remix-flat-routes"; -export const routes: RouteConfig = routesOptionAdapter( +export const routes: RouteConfig = remixRoutesOptionAdapter( (defineRoutes) => flatRoutes("routes", defineRoutes) ); ``` @@ -556,9 +556,9 @@ Or, if you were using the `routes` option to define config-based routes: ```ts filename=app/routes.ts import { flatRoutes } from "@remix-run/fs-routes"; import { type RouteConfig } from "@remix-run/route-config"; -import { routesOptionAdapter } from "@remix-run/routes-option-adapter"; +import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter"; -export const routes: RouteConfig = routesOptionAdapter( +export const routes: RouteConfig = remixRoutesOptionAdapter( (defineRoutes) => { return defineRoutes((route) => { route("/", "home/route.tsx", { index: true }); @@ -598,12 +598,12 @@ Note that if you need to mix and match different route config approaches, they c import { flatRoutes } from "@remix-run/fs-routes"; import type { RouteConfig } from "@remix-run/route-config"; import { route } from "@remix-run/route-config"; -import { routesOptionAdapter } from "@remix-run/routes-option-adapter"; +import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter"; export const routes: RouteConfig = [ ...(await flatRoutes({ rootDirectory: "fs-routes" })), - ...(await routesOptionAdapter(/* ... */)), + ...(await remixRoutesOptionAdapter(/* ... */)), route("/hello", "routes/hello.tsx"), ]; diff --git a/integration/vite-fs-routes-test.ts b/integration/vite-fs-routes-test.ts index 5e9f9d44545..1bd9d06cfb3 100644 --- a/integration/vite-fs-routes-test.ts +++ b/integration/vite-fs-routes-test.ts @@ -29,7 +29,7 @@ test.describe("fs-routes", () => { "app/routes.ts": js` import { type RouteConfig } from "@remix-run/route-config"; import { flatRoutes } from "@remix-run/fs-routes"; - import { routesOptionAdapter } from "@remix-run/routes-option-adapter"; + import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter"; export const routes: RouteConfig = [ ...await flatRoutes({ @@ -38,7 +38,7 @@ test.describe("fs-routes", () => { }), // Ensure back compat layer works - ...await routesOptionAdapter(async (defineRoutes) => { + ...await remixRoutesOptionAdapter(async (defineRoutes) => { // Ensure async routes work return defineRoutes((route) => { route("/routes/option/adapter/route", "routes-option-adapter-route.tsx") diff --git a/packages/remix-routes-option-adapter/index.ts b/packages/remix-routes-option-adapter/index.ts index bc16aa18fa8..77e8ee59b37 100644 --- a/packages/remix-routes-option-adapter/index.ts +++ b/packages/remix-routes-option-adapter/index.ts @@ -12,7 +12,7 @@ export type { DefineRoutesFunction }; * option](https://remix.run/docs/en/v2/file-conventions/vite-config#routes), * for use within `routes.ts`. */ -export async function routesOptionAdapter( +export async function remixRoutesOptionAdapter( routes: ( defineRoutes: DefineRoutesFunction ) =>