Provide a runnable local Beta and fix multi-page SVG previews

This commit is contained in:
gloamxun committed 2026-11-29 13:19:00 +08:00
1 parent fb557c09c6
commit 9841e88900
7 files changed
+324 -9

No files matched your search

+13 -3
View File
@@ -19,7 +19,7 @@ use texrra_engine::native::{
};
use texrra_tex_core::{
execution::InputProfile,
resources::{InputPolicy, WorldConfig},
resources::{InputPolicy, SearchPath, WorldConfig},
};
use tiny_http::{Header, Method, Request, Response, Server};
@@ -407,7 +407,7 @@ fn prepare(
) -> Result<EditorProject, Box<dyn std::error::Error>> {
let format_resources: Value = serde_json::from_slice(&fs::read(manifest)?)?;
let roots: Vec<PathBuf> = serde_json::from_value(format_resources["texmf_roots"].clone())?;
let mut world = WorldConfig::from_environment(run, roots.clone())?;
let mut world = WorldConfig::from_environment(run, roots)?;
world.input_policy = InputPolicy::Tex;
let name = source
.file_name()
@@ -507,8 +507,18 @@ fn prepare(
files.insert(path.clone(), Arc::from(fs::read(path)?));
}
}
let mut coverage = BTreeSet::from_iter(roots);
let mut coverage = BTreeSet::from_iter(world.texmf_roots.iter().cloned());
coverage.insert(run.to_owned());
// A successful lookup can follow a miss in an explicit search directory.
// Keep those directories in the snapshot along with the resolved bytes.
for search in world.paths.values().flatten() {
if let SearchPath::Directory { path, .. } = search {
let path = run.join(path);
if path.is_dir() {
coverage.insert(path);
}
}
}
for path in files.keys() {
if !coverage.iter().any(|root| path.starts_with(root)) {
coverage.insert(path.parent().ok_or("A resource needs a parent")?.to_owned());