* True for a file that wraps a subtree rather than rendering a page at its own * address. * * ` ` is where children render, so a route file that has one is the * layout AROUND an address and the index route beside it is the page AT it — * `_auth.invoices.tsx` and `_auth.invoices.index.
(filePath: string, content: string)
| 124 | * then the extra screen is already in the index. |
| 125 | */ |
| 126 | function isLayoutFile(filePath: string, content: string): boolean { |
| 127 | const base = filePath.slice(filePath.lastIndexOf('/') + 1); |
| 128 | if (/(?:^|\.)route\.(?:tsx|ts|jsx|js)$/.test(base)) return true; |
| 129 | return /<Outlet\b/.test(content); |
| 130 | } |
| 131 | |
| 132 | function languageForFile(filePath: string): Language { |
| 133 | if (filePath.endsWith('.tsx')) return 'tsx'; |