feat: add js package registry support for tinymist-wasm (#2102)
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
This commit is contained in:
ParaN3xus 2025-10-01 16:40:21 +08:00 committed by GitHub
parent c8e723fac7
commit b239224a63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 278 additions and 79 deletions

View file

@ -3,6 +3,7 @@
use std::{io::Read, path::Path};
use js_sys::Uint8Array;
use tinymist_std::ImmutPath;
use typst::diag::{EcoString, eco_format};
use wasm_bindgen::{JsValue, prelude::*};
@ -120,6 +121,19 @@ impl PackageRegistry for JsRegistry {
}
}
impl JsRegistry {
/// Returns the path at which non-local packages should be stored when
/// downloaded.
pub fn package_cache_path(&self) -> Option<&ImmutPath> {
None
}
/// Returns the path at which local packages are stored.
pub fn package_path(&self) -> Option<&ImmutPath> {
None
}
}
// todo
/// Safety: `JsRegistry` is only used in the browser environment, and we cannot
/// share data between workers.