reflexo_world/package/
mod.rs

1impl Notifier for DummyNotifier {}
2use std::{path::Path, sync::Arc};
3
4use ecow::EcoString;
5pub use typst::diag::PackageError;
6pub use typst::syntax::package::PackageSpec;
7
8pub mod dummy;
9
10#[cfg(feature = "browser")]
11pub mod browser;
12
13#[cfg(feature = "system")]
14pub mod http;
15
16pub trait PackageRegistry {
17    fn reset(&mut self) {}
18
19    fn resolve(&self, spec: &PackageSpec) -> Result<Arc<Path>, PackageError>;
20
21    /// A list of all available packages and optionally descriptions for them.
22    ///
23    /// This function is optional to implement. It enhances the user experience
24    /// by enabling autocompletion for packages. Details about packages from the
25    /// `@preview` namespace are available from
26    /// `https://packages.typst.org/preview/index.json`.
27    fn packages(&self) -> &[(PackageSpec, Option<EcoString>)] {
28        &[]
29    }
30}
31
32pub trait Notifier {
33    fn downloading(&self, _spec: &PackageSpec) {}
34}
35
36#[derive(Debug, Default, Clone, Copy, Hash)]
37pub struct DummyNotifier;