What depends on a file
GET https://seerepo.com/api/v1/repos/:repo/impact
Says what depends on a file, or on one of its exports, before you touch it. In JavaScript and TypeScript it follows what the code really names: a file that imports another and only uses something else of it doesn't count. In other languages it goes by whole imports, and says so.
Types aren't followed: a file that only uses a type of another isn't here. The compiler already tells you when you break a type.
Request
| Parameter | Where | Description |
|---|---|---|
repo |
path | The repo's id, or owner/name with %2F. |
path |
query | The file, from the repo's root. |
name |
query | Optional. One of its exports. |
to |
query | Optional. Another file: one shortest way from it down to this one. |
curl "https://seerepo.com/api/v1/repos/6ad79fd8e89233277ded17c9/impact?path=lib/env.ts" \
-H "Authorization: Bearer $SEEREPO_KEY"
Response
| Field | Type | Description |
|---|---|---|
data.how |
string | symbols, by what's really named, or files, by whole imports. |
data.direct.total |
number | The files that name it themselves. |
data.direct.files[] |
string | Up to 30 of them. |
data.direct.names |
object | Which of its exports each of those files names, by file. Empty when the language has no symbols to follow. |
data.reach.total |
number | Every file that depends on it, directly or through others. |
data.reach.modules[] |
object | Where those live: path, name and files, the most first. |
data.pages.total |
number | The pages it gets to, its own if it's one. |
data.pages.routes[] |
object | Up to 30: route and path. |
data.processes[] |
string | The processes it gets to: web, worker. |
data.route |
array|null | Only with to: the files from there down to this one, or null if there's no way. |
data.everyRequest.pages |
number | Present on what the framework runs before every page it matches, like Next's middleware: how many pages the repo has. |
data.tests.total, data.tests.files[] |
number, string | The tests that name it, by importing or mocking it, and the first five. They aren't in direct or reach. |
Example
{
"status": "success",
"data": {
"path": "lib/env.ts",
"how": "symbols",
"direct": { "total": 2, "files": ["lib/mail.ts", "worker/index.ts"] },
"reach": { "total": 5, "modules": [{ "path": "/account", "name": "Account", "files": 3 }] },
"pages": { "total": 1, "routes": [{ "route": "/settings", "path": "app/settings/page.tsx" }] },
"processes": ["web", "worker"]
}
}
Errors
| Status | Code | When |
|---|---|---|
| 400 | bad_path |
No file was given. |
| 402 | plan_required |
The repo is past its limit and only shows its first level. |
| 404 | unknown_file |
SeeRepo didn't read that file as part of the product. That doesn't mean nobody uses it. |
| 404 | unknown_language |
SeeRepo doesn't follow the imports of that language. That doesn't mean nothing depends on it. |
| 404 | unknown_export |
The file doesn't export that name. The message says which it does. |
| 404 | not_read_yet |
SeeRepo reads this at the repo's next push. |