feat: compile tinymist-query for wasm32 target (#1947)

- #2025 
- #2026

---------

Co-authored-by: Momijiichigo <ichigomomiji436@gmail.com>
This commit is contained in:
Myriad-Dreamin 2025-08-11 09:35:07 +08:00 committed by GitHub
parent b102b42d2c
commit 79f68dc94d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 191 additions and 88 deletions

View file

@ -20,9 +20,7 @@ use tinymist_std::typst::TypstDocument;
use tinymist_world::debug_loc::DataSource;
use tinymist_world::vfs::{PathResolution, WorkspaceResolver};
use tinymist_world::{EntryReader, DETACHED_ENTRY};
use typst::diag::{
eco_format, At, FileError, FileResult, SourceDiagnostic, SourceResult, StrResult,
};
use typst::diag::{At, FileError, FileResult, SourceDiagnostic, SourceResult, StrResult};
use typst::foundations::{Bytes, IntoValue, Module, StyleChain, Styles};
use typst::introspection::Introspector;
use typst::layout::Position;
@ -674,6 +672,7 @@ impl SharedContext {
}
/// Get the local packages and their descriptions.
#[cfg(not(target_arch = "wasm32"))]
pub fn local_packages(&self) -> EcoVec<PackageSpec> {
crate::package::list_package_by_namespace(&self.world.registry, eco_format!("local"))
.into_iter()
@ -681,6 +680,12 @@ impl SharedContext {
.collect()
}
/// Get the local packages and their descriptions.
#[cfg(target_arch = "wasm32")]
pub fn local_packages(&self) -> EcoVec<PackageSpec> {
eco_vec![]
}
pub(crate) fn const_eval(rr: ast::Expr<'_>) -> Option<Value> {
Some(match rr {
ast::Expr::None(_) => Value::None,