@@ -212,6 +212,22 @@ def _extract_app_router_routes(self, app_dir: Path) -> list[RouteInfo]:
212212 "file" : str (page_file .relative_to (self .project_dir )),
213213 })
214214
215+ # Also check .js files
216+ for page_file in app_dir .rglob ("page.js" ):
217+ rel_path = page_file .relative_to (app_dir )
218+ route_path = "/" + "/" .join (rel_path .parent .parts )
219+ route_path = re .sub (r"\[([^\]]+)\]" , r":\1" , route_path )
220+ if route_path == "/." :
221+ route_path = "/"
222+ route_path = route_path .replace ("//" , "/" )
223+
224+ routes .append ({
225+ "path" : route_path ,
226+ "method" : "GET" ,
227+ "handler" : "Page" ,
228+ "file" : str (page_file .relative_to (self .project_dir )),
229+ })
230+
215231 return routes
216232
217233 def _extract_pages_router_routes (self , pages_dir : Path ) -> list [RouteInfo ]:
@@ -263,6 +279,27 @@ def _extract_pages_router_routes(self, pages_dir: Path) -> list[RouteInfo]:
263279 "file" : str (page_file .relative_to (self .project_dir )),
264280 })
265281
282+ # Also check .js files
283+ for page_file in pages_dir .rglob ("*.js" ):
284+ if page_file .name .startswith ("_" ):
285+ continue
286+ if "api" in page_file .parts :
287+ continue
288+
289+ rel_path = page_file .relative_to (pages_dir )
290+ route_path = "/" + rel_path .with_suffix ("" ).as_posix ()
291+ route_path = route_path .replace ("/index" , "" )
292+ if not route_path :
293+ route_path = "/"
294+ route_path = re .sub (r"\[([^\]]+)\]" , r":\1" , route_path )
295+
296+ routes .append ({
297+ "path" : route_path ,
298+ "method" : "GET" ,
299+ "handler" : page_file .stem ,
300+ "file" : str (page_file .relative_to (self .project_dir )),
301+ })
302+
266303 return routes
267304
268305 def _extract_nextjs_api_routes (self ) -> list [EndpointInfo ]:
@@ -348,7 +385,11 @@ def _extract_react_router_routes(self) -> list[RouteInfo]:
348385 routes : list [RouteInfo ] = []
349386
350387 # Look for route definitions in common files
351- route_files = self ._find_files ("**/*.tsx" ) + self ._find_files ("**/*.jsx" )
388+ route_files = (
389+ self ._find_files ("**/*.tsx" ) +
390+ self ._find_files ("**/*.jsx" ) +
391+ self ._find_files ("**/*.js" )
392+ )
352393
353394 # Pattern for React Router <Route> elements
354395 route_pattern = re .compile (
@@ -396,8 +437,11 @@ def _extract_components(self) -> list[ComponentInfo]:
396437 components : list [ComponentInfo ] = []
397438
398439 # Find component files
399- component_files = self ._find_files ("**/components/**/*.tsx" ) + \
400- self ._find_files ("**/components/**/*.jsx" )
440+ component_files = (
441+ self ._find_files ("**/components/**/*.tsx" ) +
442+ self ._find_files ("**/components/**/*.jsx" ) +
443+ self ._find_files ("**/components/**/*.js" )
444+ )
401445
402446 for file in component_files :
403447 components .append ({
@@ -407,8 +451,11 @@ def _extract_components(self) -> list[ComponentInfo]:
407451 })
408452
409453 # Find page files
410- page_files = self ._find_files ("**/pages/**/*.tsx" ) + \
411- self ._find_files ("**/pages/**/*.jsx" )
454+ page_files = (
455+ self ._find_files ("**/pages/**/*.tsx" ) +
456+ self ._find_files ("**/pages/**/*.jsx" ) +
457+ self ._find_files ("**/pages/**/*.js" )
458+ )
412459
413460 for file in page_files :
414461 if not file .name .startswith ("_" ):
0 commit comments