typst / typst/typst

Hint when a newer version of an imported package is available

Open
#8,320 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

diagnostics feature request
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.