Skip to content

Commit

Permalink
chore: use minimatch for regex instead of glob-to-regexp
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <[email protected]>
  • Loading branch information
mcansh committed Apr 3, 2023
1 parent 4f70391 commit e7f26ac
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
6 changes: 2 additions & 4 deletions packages/remix-dev/config/flat-routes.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions packages/remix-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 0 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2871,11 +2871,6 @@
dependencies:
"@types/node" "*"

"@types/[email protected]":
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/[email protected]", "@types/glob@^7.1.1":
version "7.2.0"
resolved "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz"
Expand Down Expand Up @@ -7100,11 +7095,6 @@ glob-parent@^6.0.1, glob-parent@^6.0.2:
dependencies:
is-glob "^4.0.3"

[email protected]:
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==

[email protected]:
version "7.1.6"
resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
Expand Down

0 comments on commit e7f26ac

Please sign in to comment.