From db72c7b255eab0e16ed2cf2f2d3f809ffc156b9b Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Thu, 7 Nov 2024 10:44:36 +1100 Subject: [PATCH] fix(remix-dev): mark `routes.ts` support unstable (#10196) --- .changeset/popular-humans-attend.md | 6 +++--- docs/start/future-flags.md | 6 +++--- integration/helpers/vite.ts | 2 +- integration/vite-fs-routes-test.ts | 8 ++++---- integration/vite-route-config-test.ts | 8 ++++---- packages/remix-dev/__tests__/readConfig-test.ts | 2 +- packages/remix-dev/config.ts | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.changeset/popular-humans-attend.md b/.changeset/popular-humans-attend.md index 6e96b6a8fad..0b9cb985939 100644 --- a/.changeset/popular-humans-attend.md +++ b/.changeset/popular-humans-attend.md @@ -2,18 +2,18 @@ "@remix-run/dev": minor --- -Add support for `routes.ts` behind `future.v3_routeConfig` flag to assist with the migration to React Router v7. +Add support for `routes.ts` behind `future.unstable_routeConfig` flag to assist with the migration to React Router v7. Config-based routing is the new default in React Router v7, configured via the `routes.ts` file in the app directory. Support for `routes.ts` and its related APIs in Remix are designed as a migration path to help minimize the number of changes required when moving your Remix project over to React Router v7. While some new packages have been introduced within the `@remix-run` scope, these new packages only exist to keep the code in `routes.ts` as similar as possible to the equivalent code for React Router v7. -When the `v3_routeConfig` future flag is enabled, Remix's built-in file system routing will be disabled and your project will opted into React Router v7's config-based routing. +When the `unstable_routeConfig` future flag is enabled, Remix's built-in file system routing will be disabled and your project will opted into React Router v7's config-based routing. To enable the flag, in your `vite.config.ts` file: ```ts remix({ future: { - v3_routeConfig: true, + unstable_routeConfig: true, }, }); ``` diff --git a/docs/start/future-flags.md b/docs/start/future-flags.md index d0ed2ee3803..e5da3d7d932 100644 --- a/docs/start/future-flags.md +++ b/docs/start/future-flags.md @@ -472,11 +472,11 @@ You shouldn't need to make any changes to your application code for this feature You may find some usage for the new [``][discover-prop] API if you wish to disable eager route discovery on certain links. -## v3_routeConfig +## unstable_routeConfig Config-based routing is the new default in React Router v7, configured via the `routes.ts` file in the app directory. Support for `routes.ts` and its related APIs in Remix are designed as a migration path to help minimize the number of changes required when moving your Remix project over to React Router v7. While some new packages have been introduced within the `@remix-run` scope, these new packages only exist to keep the code in `routes.ts` as similar as possible to the equivalent code for React Router v7. -When the `v3_routeConfig` future flag is enabled, Remix's built-in file system routing will be disabled and your project will opted into React Router v7's config-based routing. To opt back in to file system routing, this can be explicitly configured within `routes.ts` as we'll cover below. +When the `unstable_routeConfig` future flag is enabled, Remix's built-in file system routing will be disabled and your project will opted into React Router v7's config-based routing. To opt back in to file system routing, this can be explicitly configured within `routes.ts` as we'll cover below. **Update your code** @@ -487,7 +487,7 @@ To migrate Remix's file system routing and route config to the equivalent setup ```ts filename=vite.config.ts remix({ future: { - v3_routeConfig: true, + unstable_routeConfig: true, }, }); ``` diff --git a/integration/helpers/vite.ts b/integration/helpers/vite.ts index cf6cc609dbf..c3095a9e6d4 100644 --- a/integration/helpers/vite.ts +++ b/integration/helpers/vite.ts @@ -43,7 +43,7 @@ export const viteConfig = { export default { ${await viteConfig.server(args)} plugins: [remix(${ - args.routeConfig ? "{ future: { v3_routeConfig: true } }" : "" + args.routeConfig ? "{ future: { unstable_routeConfig: true } }" : "" })] } `; diff --git a/integration/vite-fs-routes-test.ts b/integration/vite-fs-routes-test.ts index 09c6755681c..856c61ba5e3 100644 --- a/integration/vite-fs-routes-test.ts +++ b/integration/vite-fs-routes-test.ts @@ -24,7 +24,7 @@ test.describe("fs-routes", () => { export default defineConfig({ plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, })], }); `, @@ -257,7 +257,7 @@ test.describe("emits warnings for route conflicts", async () => { export default defineConfig({ plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, })], }); `, @@ -331,7 +331,7 @@ test.describe("", () => { export default defineConfig({ plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, })], }); `, @@ -380,7 +380,7 @@ test.describe("pathless routes and route collisions", () => { export default defineConfig({ plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, })], }); `, diff --git a/integration/vite-route-config-test.ts b/integration/vite-route-config-test.ts index 28c96e9f34b..f5f63d2c2fa 100644 --- a/integration/vite-route-config-test.ts +++ b/integration/vite-route-config-test.ts @@ -43,7 +43,7 @@ test.describe("route config", () => { export default { plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, })] } `, @@ -64,7 +64,7 @@ test.describe("route config", () => { export default { plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, routes: () => {}, })] } @@ -88,7 +88,7 @@ test.describe("route config", () => { export default { ${await viteConfig.server({ port })} plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, routes: () => {}, })] } @@ -113,7 +113,7 @@ test.describe("route config", () => { export default { plugins: [remix({ - future: { v3_routeConfig: true }, + future: { unstable_routeConfig: true }, })] } `, diff --git a/packages/remix-dev/__tests__/readConfig-test.ts b/packages/remix-dev/__tests__/readConfig-test.ts index f24e37ecf5e..ca4c9a050a4 100644 --- a/packages/remix-dev/__tests__/readConfig-test.ts +++ b/packages/remix-dev/__tests__/readConfig-test.ts @@ -37,10 +37,10 @@ describe("readConfig", () => { "entryServerFilePath": Any, "future": { "unstable_optimizeDeps": false, + "unstable_routeConfig": false, "v3_fetcherPersist": false, "v3_lazyRouteDiscovery": false, "v3_relativeSplatPath": false, - "v3_routeConfig": false, "v3_singleFetch": false, "v3_throwAbortReason": false, }, diff --git a/packages/remix-dev/config.ts b/packages/remix-dev/config.ts index 2c0d9a65d57..61980caf071 100644 --- a/packages/remix-dev/config.ts +++ b/packages/remix-dev/config.ts @@ -50,8 +50,8 @@ interface FutureConfig { v3_throwAbortReason: boolean; v3_singleFetch: boolean; v3_lazyRouteDiscovery: boolean; - v3_routeConfig: boolean; unstable_optimizeDeps: boolean; + unstable_routeConfig: boolean; } type NodeBuiltinsPolyfillOptions = Pick< @@ -579,7 +579,7 @@ export async function resolveConfig( root: { path: "", id: "root", file: rootRouteFile }, }; - if (appConfig.future?.v3_routeConfig) { + if (appConfig.future?.unstable_routeConfig) { invariant(routesViteNodeContext); invariant(vite); @@ -721,8 +721,8 @@ export async function resolveConfig( v3_throwAbortReason: appConfig.future?.v3_throwAbortReason === true, v3_singleFetch: appConfig.future?.v3_singleFetch === true, v3_lazyRouteDiscovery: appConfig.future?.v3_lazyRouteDiscovery === true, - v3_routeConfig: appConfig.future?.v3_routeConfig === true, unstable_optimizeDeps: appConfig.future?.unstable_optimizeDeps === true, + unstable_routeConfig: appConfig.future?.unstable_routeConfig === true, }; if (appConfig.future) {