There a couple of pre-processing tasks that are outside the scope of Typst, such as downloading and possibly installing required packages and fonts from repositories, converting PDF to SVG, converting CMYK to RGB, stripping meta-data from files, fetching JSON/XML/… data from URLs, converting documents using Pandoc, etc.
To perform those tasks when needed, I’d like to alias the Typst compiler to a wrapper that delegates fetching and preprocessing of all document dependencies (packages, fonts, images) to a Make-/Task-/Justfile. I.e. for each file missing, I’d like to invoke Make/Task/Just with the name of the missing file.
Ideally I’d like to get all dependencies at once, instead of calling the compiler over and over while listening for error messages. So my question is: Is there a way to query the Typst compiler for all (unfulfilled) dependencies, or how would you approach this?
I think this only addresses part of your desire, but the prequery package allows you to specify a URL as an image source then the preprocessing step will download those images. If the document is compiled before the preprocessing step (ie the images aren’t local) then the package shows a placeholder.
Maybe this package could be extended to meet all of your expectations.
Thanks, this could probably work without unmodified documents if there was a way to monkey-patch the built-in import, image, … functions. But I don’t think that’s currently possible.