module

Noir::TreeSitterReactRouterConfigExtractor

Tree-sitter reader for React Router v7's route config (app/routes.ts).

export default [
  index("routes/home.tsx"),
  route("about", "routes/about.tsx"),
  layout("routes/auth/layout.tsx", [
    route("login", "routes/auth/login.tsx"),
  ]),
  ...prefix("concerts", [
    route(":city", "routes/concerts/city.tsx"),
  ]),
  ...(await flatRoutes()),
] satisfies RouteConfig;

Yields one Route per route() / index() call with the path joined through every enclosing route() / prefix(), in React Router syntax (/concerts/:city). layout() adds no path and is not itself a URL. flatRoutes() is reported as a flag: the file convention it turns on is the analyzer's business, not the config's.

Instance methods

extract(source : String, path : String = "") : Config
Source

Nested types