Skip to content

refactor(wasm): move fs API to separate module and add wasm shim [FS API Breaking Changes] - #2521

Merged
xusd320 merged 3 commits into
nextfrom
refactor/fs-api-and-wasm-shim
Jan 19, 2026
Merged

refactor(wasm): move fs API to separate module and add wasm shim [FS API Breaking Changes]#2521
xusd320 merged 3 commits into
nextfrom
refactor/fs-api-and-wasm-shim

Conversation

@xusd320

@xusd320 xusd320 commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

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_module shim according to wasm-bindgen/wasm-bindgen#4906

- 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
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 utoo-wasm crate by moving all file system-related logic into a new, dedicated fs.rs module. This change enhances code organization and maintainability by clearly separating concerns. It also introduces a WASM shim for direct access to the WebAssembly module and memory, and updates the wasm-bindgen ecosystem dependencies to their latest versions. The corresponding JavaScript/TypeScript bindings have been adjusted to consume these new, streamlined APIs.

Highlights

  • Filesystem API Refactoring: The filesystem (FS) API has been extracted from project.rs into a new, dedicated fs.rs module. This improves modularity and separates concerns, making the Project struct solely responsible for project-level operations.
  • WASM Shim for Module and Memory Access: A new wasm_shim.rs module has been introduced, providing getWasmModule and getWasmMemory functions. These functions offer direct access to the WebAssembly module and memory from JavaScript, which is crucial for advanced WASM integrations, especially in worker contexts.
  • WASM-Bindgen Dependency Upgrade: The wasm-bindgen dependency and its related crates (e.g., js-sys, wasm-bindgen-futures, web-sys) have been upgraded to version 0.2.108. This update ensures the project benefits from the latest features, bug fixes, and performance improvements in the WASM ecosystem.
  • Comprehensive Filesystem Operations: The new Fs struct in fs.rs now encapsulates a full suite of asynchronous and synchronous filesystem operations, including reading, writing, directory manipulation (create, read, remove), file copying, and metadata retrieval. This centralizes all file system interactions.
  • Frontend Integration Update: The JavaScript/TypeScript frontend code has been updated to utilize the newly refactored Fs API for all filesystem operations and the getWasmModule/getWasmMemory shims for WASM module interactions, ensuring seamless integration with the Rust changes.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/utooweb-ci.yml
    • .github/workflows/utooweb-release.yml
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@xusd320 xusd320 changed the title refactor: move fs API to separate module and add wasm shim refactor(wasm): move fs API to separate module and add wasm shim [FS API Breaking Changes] Jan 19, 2026
@xusd320
xusd320 requested a review from elrrrrrrr January 19, 2026 08:50
elrrrrrrr
elrrrrrrr previously approved these changes Jan 19, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread crates/utoo-wasm/src/fs.rs
Comment thread packages/utoo-web/src/webpackLoaders/loaderWorkerPool.ts Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@xusd320
xusd320 disabled auto-merge January 19, 2026 09:49
@xusd320
xusd320 merged commit 09e6add into next Jan 19, 2026
22 checks passed
@xusd320
xusd320 deleted the refactor/fs-api-and-wasm-shim branch January 19, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants