summaryrefslogtreecommitdiff
path: root/crates/typst-cli
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-10-27 19:04:55 +0100
committerGitHub <noreply@github.com>2024-10-27 18:04:55 +0000
commitbe7cfc85d08c545abfac08098b7b33b4bd71f37e (patch)
treef4137fa2aaa57babae1f7603a9b2ed7e688f43d8 /crates/typst-cli
parentb8034a343831e8609aec2ec81eb7eeda57aa5d81 (diff)
Split out four new crates (#5302)
Diffstat (limited to 'crates/typst-cli')
-rw-r--r--crates/typst-cli/Cargo.toml4
-rw-r--r--crates/typst-cli/src/main.rs3
-rw-r--r--crates/typst-cli/src/query.rs3
-rw-r--r--crates/typst-cli/src/timings.rs3
-rw-r--r--crates/typst-cli/src/world.rs4
5 files changed, 9 insertions, 8 deletions
diff --git a/crates/typst-cli/Cargo.toml b/crates/typst-cli/Cargo.toml
index 1c622d1e..855d7bee 100644
--- a/crates/typst-cli/Cargo.toml
+++ b/crates/typst-cli/Cargo.toml
@@ -19,7 +19,7 @@ doc = false
[dependencies]
typst = { workspace = true }
-typst-assets = { workspace = true, features = ["fonts"] }
+typst-eval = { workspace = true }
typst-kit = { workspace = true }
typst-macros = { workspace = true }
typst-pdf = { workspace = true }
@@ -28,8 +28,8 @@ typst-svg = { workspace = true }
typst-timing = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
-color-print = { workspace = true }
codespan-reporting = { workspace = true }
+color-print = { workspace = true }
comemo = { workspace = true }
dirs = { workspace = true }
ecow = { workspace = true }
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);