diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-10-27 19:04:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-27 18:04:55 +0000 |
| commit | be7cfc85d08c545abfac08098b7b33b4bd71f37e (patch) | |
| tree | f4137fa2aaa57babae1f7603a9b2ed7e688f43d8 /crates/typst-cli/src | |
| parent | b8034a343831e8609aec2ec81eb7eeda57aa5d81 (diff) | |
Split out four new crates (#5302)
Diffstat (limited to 'crates/typst-cli/src')
| -rw-r--r-- | crates/typst-cli/src/main.rs | 3 | ||||
| -rw-r--r-- | crates/typst-cli/src/query.rs | 3 | ||||
| -rw-r--r-- | crates/typst-cli/src/timings.rs | 3 | ||||
| -rw-r--r-- | crates/typst-cli/src/world.rs | 4 |
4 files changed, 7 insertions, 6 deletions
diff --git a/crates/typst-cli/src/main.rs b/crates/typst-cli/src/main.rs index b14e687e..464ad624 100644 --- a/crates/typst-cli/src/main.rs +++ b/crates/typst-cli/src/main.rs @@ -94,9 +94,10 @@ fn print_error(msg: &str) -> io::Result<()> { #[cfg(not(feature = "self-update"))] mod update { - use crate::args::UpdateCommand; use typst::diag::{bail, StrResult}; + use crate::args::UpdateCommand; + pub fn update(_: &UpdateCommand) -> StrResult<()> { bail!( "self-updating is not enabled for this executable, \ diff --git a/crates/typst-cli/src/query.rs b/crates/typst-cli/src/query.rs index ef3c7951..90d99a5a 100644 --- a/crates/typst-cli/src/query.rs +++ b/crates/typst-cli/src/query.rs @@ -2,11 +2,11 @@ use comemo::Track; use ecow::{eco_format, EcoString}; use serde::Serialize; use typst::diag::{bail, HintedStrResult, StrResult, Warned}; -use typst::eval::{eval_string, EvalMode}; use typst::foundations::{Content, IntoValue, LocatableSelector, Scope}; use typst::model::Document; use typst::syntax::Span; use typst::World; +use typst_eval::{eval_string, EvalMode}; use crate::args::{QueryCommand, SerializationFormat}; use crate::compile::print_diagnostics; @@ -56,6 +56,7 @@ fn retrieve( document: &Document, ) -> HintedStrResult<Vec<Content>> { let selector = eval_string( + &typst::ROUTINES, world.track(), &command.selector, Span::detached(), diff --git a/crates/typst-cli/src/timings.rs b/crates/typst-cli/src/timings.rs index df7665b7..4446bbf9 100644 --- a/crates/typst-cli/src/timings.rs +++ b/crates/typst-cli/src/timings.rs @@ -72,7 +72,8 @@ impl Timer { let writer = BufWriter::with_capacity(1 << 20, file); typst_timing::export_json(writer, |span| { - resolve_span(world, span).unwrap_or_else(|| ("unknown".to_string(), 0)) + resolve_span(world, Span::from_raw(span)) + .unwrap_or_else(|| ("unknown".to_string(), 0)) })?; Ok(output) diff --git a/crates/typst-cli/src/world.rs b/crates/typst-cli/src/world.rs index bb491c02..b790f41a 100644 --- a/crates/typst-cli/src/world.rs +++ b/crates/typst-cli/src/world.rs @@ -16,7 +16,7 @@ use typst::utils::LazyHash; use typst::{Library, World}; use typst_kit::fonts::{FontSlot, Fonts}; use typst_kit::package::PackageStorage; -use typst_timing::{timed, TimingScope}; +use typst_timing::timed; use crate::args::{Input, SharedArgs}; use crate::compile::ExportCache; @@ -285,8 +285,6 @@ impl FileSlot { self.source.get_or_init( || read(self.id, project_root, package_storage), |data, prev| { - let name = if prev.is_some() { "reparsing file" } else { "parsing file" }; - let _scope = TimingScope::new(name, None); let text = decode_utf8(&data)?; if let Some(mut prev) = prev { prev.replace(text); |
