feat: ensure main in compile function (#1287) (#1325)

This commit is contained in:
Myriad-Dreamin 2025-02-19 22:01:28 +08:00 committed by GitHub
parent f5fb352a2a
commit 5920b1b671
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -345,6 +345,14 @@ impl<F: CompilerFeat> WorldComputeGraph<F> {
/// Compile once from scratch.
pub fn pure_compile(&self) -> Warned<SourceResult<Arc<TypstPagedDocument>>> {
let res = self.ensure_main();
if let Err(err) = res {
return Warned {
output: Err(err),
warnings: EcoVec::new(),
};
}
let res = ::typst::compile(&self.snap.world);
// compile document
Warned {