diff --git a/.changeset/flat-routes-minimatch.md b/.changeset/flat-routes-minimatch.md new file mode 100644 index 00000000000..2ad113149a2 --- /dev/null +++ b/.changeset/flat-routes-minimatch.md @@ -0,0 +1,6 @@ +--- +"remix": patch +"@remix-run/dev": patch +--- + +use minimatch for regex instead of glob-to-regexp diff --git a/packages/remix-dev/config/flat-routes.ts b/packages/remix-dev/config/flat-routes.ts index 04183dc9e39..1cbee1f6176 100644 --- a/packages/remix-dev/config/flat-routes.ts +++ b/packages/remix-dev/config/flat-routes.ts @@ -1,6 +1,6 @@ import fs from "node:fs"; import path from "node:path"; -import globToRegex from "glob-to-regexp"; +import minimatch from "minimatch"; import type { ConfigRoute, RouteManifest } from "./routes"; import { normalizeSlashes } from "./routes"; @@ -77,9 +77,7 @@ export function flatRoutes( ignoredFilePatterns: string[] = [], prefix = "routes" ) { - let ignoredFileRegex = ignoredFilePatterns.map((pattern) => { - return globToRegex(pattern); - }); + let ignoredFileRegex = ignoredFilePatterns.map((re) => minimatch.makeRe(re)); let routesDir = path.join(appDirectory, prefix); let rootRoute = findConfig(appDirectory, "root", routeModuleExts); diff --git a/packages/remix-dev/package.json b/packages/remix-dev/package.json index 079b57f1235..0636dae588f 100644 --- a/packages/remix-dev/package.json +++ b/packages/remix-dev/package.json @@ -43,7 +43,6 @@ "fast-glob": "3.2.11", "fs-extra": "^10.0.0", "get-port": "^5.1.1", - "glob-to-regexp": "0.4.1", "gunzip-maybe": "^1.4.2", "inquirer": "^8.2.1", "jsesc": "3.0.2", @@ -75,7 +74,6 @@ "devDependencies": { "@remix-run/serve": "1.15.0", "@types/cacache": "^15.0.0", - "@types/glob-to-regexp": "0.4.1", "@types/gunzip-maybe": "^1.4.0", "@types/inquirer": "^8.2.0", "@types/jsesc": "^3.0.1", diff --git a/yarn.lock b/yarn.lock index 05daa1db145..b1dfa8d0743 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2871,11 +2871,6 @@ dependencies: "@types/node" "*" -"@types/glob-to-regexp@0.4.1": - version "0.4.1" - resolved "https://registry.npmjs.org/@types/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#f684bc7b9a24691f1f80d045dbb7260bf9cc415b" - integrity sha512-S0mIukll6fbF0tvrKic/jj+jI8SHoSvGU+Cs95b/jzZEnBYCbj+7aJtQ9yeABuK3xP1okwA3jEH9qIRayijnvQ== - "@types/glob@*", "@types/glob@7.2.0", "@types/glob@^7.1.1": version "7.2.0" resolved "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz" @@ -7100,11 +7095,6 @@ glob-parent@^6.0.1, glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob-to-regexp@0.4.1: - version "0.4.1" - resolved "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - glob@7.1.6: version "7.1.6" resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"