typdeps is a small wrapper that lets Typst projects import third-party packages with #import "@ns/name" (no version in source files). It resolves dependencies from typst.toml, pins them in typst.lock, rewrites imports into a temporary workspace, and then runs the real typst compile.
- Rust (to build the tool)
git(to fetch git dependencies)typstCLI on PATH (invoked bytypdeps run)
cargo build
# or install locally
cargo install --path .# in your Typst project directory
typdeps init
typdeps add gh:owner/repo?ref=main&subdir=.
typdeps run -- typst compile main.typ
# strict/CI mode (refuse lock updates)
typdeps sync
typdeps run --locked -- typst compile main.typ- Dependencies come only from
typst.toml [dependencies](git only; nopathdeps). - Only string-literal
#import "@ns/name"is rewritten.- Versioned imports like
@foo/bar:1.2.3are not rewritten. - Non-literal import expressions are hard errors with file:line:col.
- Versioned imports like
typdeps runcompiles from a temp workspace, but keeps paths stable:- Relative outputs are written back under the real project directory.
- If
[output]is omitted and<input> != "-",typdepsinjects the default output path (next to the input; extension follows--format/-f, defaultpdf).
[dependencies]
"@foo/bar" = { git = "https://github.com/example-user/example-package", ref = "main", subdir = "." }Rules:
- Keys are always
@ns/name(no version in the key). - Only git dependencies are supported.
refis optional and may be a branch, tag, or commit (it is passed togit checkout).subdiris optional and defaults to".".
typst.toml missing but third-party imports found: addtypst.tomlor remove@ns/nameimports.typst.lock missing; run typdeps sync: runtypdeps sync, or run without--lockedonce.typst.lock is stale (manifest-hash mismatch): runtypdeps sync.unsupported import expression: only string-literal#import "@ns/name"is supported.missing [package].entrypoint: dependency package must defineentrypointin itstypst.toml.
docs/overview.md: project purpose, constraints, and module mapdocs/cli.md: CLI contractdocs/workspace.md: workspace layout and path transparencydocs/resolution.md: dependency resolutiondocs/lockfile.md:typst.lockformat and determinismdocs/cache-git.md: git cache layout and hashingdocs/errors.md: strict error semanticsdocs/development.md: testing and development notes