(entries: WireEntryPoints | null)
| 232 | } |
| 233 | |
| 234 | export function buildEntryPanel(entries: WireEntryPoints | null): EntryPanel { |
| 235 | if (!entries) return { sections: [], rows: [], empty: null }; |
| 236 | const sections: EntrySection[] = []; |
| 237 | |
| 238 | // A project with fewer than three resolvable routes is not a routed app, and |
| 239 | // the engine says so rather than half-answering. No Routes heading at all in |
| 240 | // that case — an empty box under a heading reads as a failure, and this is |
| 241 | // the ordinary shape of a library. |
| 242 | if (entries.routes.routed && entries.routes.items.items.length > 0) { |
| 243 | sections.push( |
| 244 | section( |
| 245 | 'routes', |
| 246 | 'Routes', |
| 247 | entries.routes.items.items.every((r) => !r.method) |
| 248 | ? 'A screen of the app — its path, and the component that renders it.' |
| 249 | : 'A request from outside arrives here — the URL, and the symbol that serves it.', |
| 250 | entries.routes.items, |
| 251 | groupRows( |
| 252 | entries.routes.items.items.map((route) => ({ |
| 253 | row: routeRow(route), |
| 254 | // Grouped by where the URL is REGISTERED, not by where it is |
| 255 | // served: a router file is the shape a reader already has in mind, |
| 256 | // and handlers scatter across a package. |
| 257 | path: route.routeFile, |
| 258 | file: route.routeFile, |
| 259 | })) |
| 260 | ), |
| 261 | false, |
| 262 | frameworkPhrase(entries.frameworks) |
| 263 | ) |
| 264 | ); |
| 265 | } |
| 266 | |
| 267 | if (entries.files.items.length > 0) { |
| 268 | sections.push( |
| 269 | section( |
| 270 | 'files', |
| 271 | 'Top-level files with calls', |
| 272 | 'Statements at the top level of the file — a CLI, a worker entry, a script.', |
| 273 | entries.files, |
| 274 | groupRows( |
| 275 | entries.files.items.map((file) => ({ |
| 276 | row: fileRow(file), |
| 277 | path: directoryOf(file.file), |
| 278 | file: null, |
| 279 | })) |
| 280 | ), |
| 281 | true |
| 282 | ) |
| 283 | ); |
| 284 | } |
| 285 | |
| 286 | if (entries.tests.items.length > 0) { |
| 287 | sections.push( |
| 288 | section( |
| 289 | 'tests', |
| 290 | 'Tests', |
| 291 | 'What already exercises this code, widest reach first.', |
no test coverage detected