typst / typst/packages

`./assets` in the `exclude` field of `typst.toml` actually matches `**/assets`

Open
#3,617 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1k
Forks
1.3k
Avg merge
2d 22h
Merged PRs (30d)
189

Description

Description

https://github.com/typst/packages/blob/8785ec6f6da2e7896db08857d38d6ed4cddebce8/docs/manifest.md?plain=1#L68

It looks like an array of globs is the only description for the format of the exclude field in typst.toml.
This ambiguity cause problems.

https://github.com/QuadnucYard/ourchat-typ/issues/3 is an example.
This package has the following file structure.

  • /typst.toml
  • /assets/ (to be excluded)
  • /src/
    • /src/assets/ (to be included)

The package specifies ./assets, but surprisingly, it matches both /assets/ and /src/assets/.

exclude = ["./assets"]

Analysis

The bundler trims the ./ prefix, and uses a library for .gitignore to parse the glob.
As a result, ./assets becomes assets, and matches recursively.
https://github.com/typst/packages/blob/8785ec6f6da2e7896db08857d38d6ed4cddebce8/bundler/src/main.rs#L336
(introduced in https://github.com/typst/packages/commit/b41d4831f9e4f54a71c25336b658021a6824fc7a)

Workaround

Use /assets.
(not confirmed yet)

Confirmed with https://github.com/typst-community/dev-builds/releases/tag/packages-bundler-main.2025-12-10.8c2f3eb.

Links

Discord

Contributor guide

No contributing guide indexed for this repository

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 with bundler/src/main.rs around line 336 and compare its exclude handling with the format described at docs/manifest.md line 68. Reproduce the behavior using the package layout in the report, including /assets and /src/assets. Done means the intended path-matching behavior is implemented and the exclude-field documentation is no longer ambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.