refactor(wasm): move fs API to separate module and add wasm shim [FS API Breaking Changes] - #2521
Conversation
- Move all filesystem operations from project.rs to fs.rs - Create new Fs struct with async and sync fs methods - Add wasm_shim.rs with getWasmModule/getWasmMemory exports - Update TypeScript code to use Fs instead of Project for fs ops - Update loaderWorkerPool to use getWasmModule()/getWasmMemory() - Upgrade wasm-bindgen to 0.2.108 and update CI workflows
Summary of ChangesHello @xusd320, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the filesystem API within the Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a solid refactoring effort. It moves the filesystem API from project.rs to a dedicated fs.rs module, which greatly improves code organization and separation of concerns. The introduction of a wasm_shim for getWasmModule and getWasmMemory is a good practice for managing WebAssembly resources, especially with web workers. The dependency upgrades for wasm-bindgen are also a welcome update.
I've identified a critical issue regarding the use of unsafe code for string conversion, which could lead to undefined behavior. I've also found a potential runtime error in the TypeScript code due to a change in how an object is passed. Addressing these points will make this PR even better.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Move fs API from project.rs to fs.rs, add wasm_shim for getWasmModule/getWasmMemory, upgrade wasm-bindgen to 0.2.108.
Have to add
get_wasm_moduleshim according to wasm-bindgen/wasm-bindgen#4906