Hint when a newer version of an imported package is available
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 56.1k
- Forks
- 1.7k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 22
Description
Description
When a document imports a remote package, the compiler has no way to signal that a newer version exists. Users may unknowingly remain on outdated package versions indefinitely, with no prompt to update. It would be useful if the compiler could emit a hint-level diagnostic on an #import line when a newer version of that package is available in the registry index, something like:
hint: a newer version of @preview/cetz is available (0.5.0 → 0.5.2)
It seems the registry index (https://packages.typst.org/preview/index.json) already contains all the information needed?
Use Case
Typst intentionally requires fully-pinned versions in import statements, which is good for reproducibility. The downside is that there's no ambient signal that a package has been updated. A hint diagnostic would be informational, non-blocking, and surfaced exactly where it's actionable.
EDIT:
Looking at the source code, it seems the required infrastructure already exists in typst-kit? UniversePackages::latest_version() fetches and parses index.json, filters by package name, and returns the maximum available version (it's already called in the package() download path to improve the error message when a requested version doesn't exist). The index fetch is lazy via OnceCell, so it only hits the network once per session regardless of how many imports a document has.
The only new work needed is: after successfully resolving a pinned import, call SystemPackages::latest_version() on its versionless spec, compare against the pinned version, and emit a hint if a newer version is available.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading typst-kit's UniversePackages::latest_version() and tracing the package resolution path for a successfully resolved pinned #import. Check how SystemPackages::latest_version() can compare the pinned and latest versions without changing reproducibility. Done means a newer registry version produces a non-blocking hint diagnostic while current or unavailable versions do not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100