feat(wasm): expose MemoryFileSystem via WASM API#6428
Conversation
ae191aa to
fd626c3
Compare
CodSpeed Performance ReportMerging #6428 will not alter performanceComparing Summary
|
fd626c3 to
284db91
Compare
| let base_dir = if cfg!(target_family = "wasm") { | ||
| PathBuf::from("/") | ||
| } else { | ||
| std::env::current_dir()? |
There was a problem hiding this comment.
std::env::current_dir() was called inside Absolutize::absolutize_from implicity and caused "not supported on this platform" error.
eebdc18 to
8688a0f
Compare
8688a0f to
7e251b5
Compare
🦋 Changeset detectedLatest commit: b9f403f The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
7e251b5 to
42ce884
Compare
|
|
||
| /// Create or update a file in the filesystem | ||
| pub fn insert(&mut self, path: Utf8PathBuf, content: impl Into<Vec<u8>>) { | ||
| pub fn insert(&self, path: Utf8PathBuf, content: impl Into<Vec<u8>>) { |
There was a problem hiding this comment.
Removed excess mutability from here and the diff has many of removing mut keywords 😢
13408f9 to
ecada68
Compare
| #[wasm_bindgen(js_name = remove)] | ||
| pub fn remove(&self, path: &str) { | ||
| self.inner.remove(Utf8Path::new(path)); | ||
| } |
There was a problem hiding this comment.
Should we also export an "update" function? Genuinely asking
There was a problem hiding this comment.
I think no, we can use insert to update a file
Summary
Added
MemoryFileSystemto the WASM API.Now we can access the memory filesystem from outside, insert or remove files.
As a bonus, GritQL plugins are now supported to be called on WASM builds.
Test Plan
Manually tested with playground