-
-
Notifications
You must be signed in to change notification settings - Fork 664
feat(wasm): expose MemoryFileSystem via WASM API #6428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -97,7 +97,7 @@ impl MemoryFileSystem { | |||
} | |||
|
|||
/// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also export an "update" function? Genuinely asking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no, we can use insert
to update a file
Summary
Added
MemoryFileSystem
to 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