Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 1 | /** |
| 2 | * The Files page's About, streamed in after the files: what the default | |
| 3 | * branch says, stars and releases from repos; how many watch it from the | |
| The repository sidebar reads like it should. TSX counts as TypeScript, as JSX already counted as JavaScript, so one language is not split in two (stats version 3, so every repository is read again); the languages list every one down to a tenth of a percent, the largest eight, rather than folding MDX, CSS and Shell into Other; up to five contributors are listed by name, each with their commits and card, more as avatars; and with no release published, Releases says how many tags there are, linked to them. | 4 | * inbox; packages published from it; how many tags it has. Each is its own promise, so a slow |
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 5 | * one holds up only its own section, and a failure shows the section |
| 6 | * without it rather than failing the page. | |
| 7 | */ | |
| 8 | import type { PackageSummary, RepoAbout, RepoPath, Viewer } from "@g1t/contracts"; | |
| 9 | ||
| 10 | import type { AboutData } from "../components/repo-about"; | |
| 11 | import { inbox, packages, repos } from "./services.server"; | |
| 12 | ||
| 13 | /** How long a section waits before it shows without its answer. */ | |
| 14 | const WAIT_MS = 4_000; | |
| 15 | ||
| 16 | function within<T>(promise: Promise<T>): Promise<T | null> { | |
| 17 | return Promise.race([promise.catch(() => null), new Promise<null>((resolve) => setTimeout(() => resolve(null), WAIT_MS))]); | |
| 18 | } | |
| 19 | ||
| 20 | export function aboutOf(path: RepoPath, viewer: Viewer): Promise<RepoAbout | null> { | |
| 21 | return repos.about(path, viewer).then((found) => (found.ok ? found.value : null)); | |
| 22 | } | |
| 23 | ||
| 24 | export function aboutFor(path: RepoPath, viewer: Viewer, repoId: string): AboutData { | |
| 25 | return { | |
| 26 | about: within(aboutOf(path, viewer)), | |
| 27 | watchers: within(inbox.watchers(repoId)), | |
| 28 | packages: within( | |
| 29 | packages.list(path.namespace, viewer, { repoId }).then((found): PackageSummary[] | null => (found.ok ? found.value : null)), | |
| 30 | ), | |
| The repository sidebar reads like it should. TSX counts as TypeScript, as JSX already counted as JavaScript, so one language is not split in two (stats version 3, so every repository is read again); the languages list every one down to a tenth of a percent, the largest eight, rather than folding MDX, CSS and Shell into Other; up to five contributors are listed by name, each with their commits and card, more as avatars; and with no release published, Releases says how many tags there are, linked to them. | 31 | tags: within(repos.tags(path, viewer).then((found) => (found.ok ? found.value.length : null))), |
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 32 | }; |
| 33 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.