wasm-git icon indicating copy to clipboard operation
wasm-git copied to clipboard

WASMFS and WASI support

Open petersalomonsen opened this issue 2 years ago • 6 comments

Work in progress. Here's a screenshot of a Wasi build, displaying the available commands of lg2.wasm running with wasmtime:

image

And here's an initial test with WASMFS:

https://github.com/petersalomonsen/wasm-git/pull/88/commits/844fa31cb2f03b419c54cc7fcac73e499bd78e65

petersalomonsen avatar Dec 16 '23 16:12 petersalomonsen

@petersalomonsen Any update on this? Is there any effort pending for this to get merged?

kesavkolla avatar May 07 '24 03:05 kesavkolla

@petersalomonsen Any update on this? Is there any effort pending for this to get merged?

@kesavkolla I will not merge this, but rather split it up into separate parts for what's in here:

  • WASMFS/OPFS: From what I learned [here])(https://github.com/emscripten-core/emscripten/issues/18112) either threads or JSPI is needed, which are currently not supported without enabling special flags in chrome. For wasm-git it should be a special build for those who are interested in it, and it also makes sense to have it in a separate PR.
  • WASI: I got quickly into limitations with WASI 1, especially when it comes to network requests for pull/push. I have done some experimenting on the component model (WASI 2), and so I will rather revisit that when it becomes more official. Also in a separate PR then.
  • ES6 build is probably the lowest hanging fruit here, so that will come soon
  • Devcontainer setup is also straightforward, so I will separate that out

Which of these are you most interested in?

petersalomonsen avatar May 07 '24 04:05 petersalomonsen

@petersalomonsen Any update on this? Is there any effort pending for this to get merged?

@kesavkolla I will not merge this, but rather split it up into separate parts for what's in here:

  • WASMFS/OPFS: From what I learned [here])(WasmFS: Current directory ignores custom backend emscripten-core/emscripten#18112) either threads or JSPI is needed, which are currently not supported without enabling special flags in chrome. For wasm-git it should be a special build for those who are interested in it, and it also makes sense to have it in a separate PR.
  • WASI: I got quickly into limitations with WASI 1, especially when it comes to network requests for pull/push. I have done some experimenting on the component model (WASI 2), and so I will rather revisit that when it becomes more official. Also in a separate PR then.
  • ES6 build is probably the lowest hanging fruit here, so that will come soon
  • Devcontainer setup is also straightforward, so I will separate that out

Which of these are you most interested in?

I don't know what is the best behavior either WASI or WASMFS/OPFS. Ideally the requirement is to run the git commands right from the browser's filesystem. I was hoping OPFS is the right choice as I can then use the filesystem API to access the files and then once changes are made use git command to push the changes.

kesavkolla avatar May 07 '24 17:05 kesavkolla

@petersalomonsen Any update on this? Is there any effort pending for this to get merged?

@kesavkolla I will not merge this, but rather split it up into separate parts for what's in here:

  • WASMFS/OPFS: From what I learned [here])(WasmFS: Current directory ignores custom backend emscripten-core/emscripten#18112) either threads or JSPI is needed, which are currently not supported without enabling special flags in chrome. For wasm-git it should be a special build for those who are interested in it, and it also makes sense to have it in a separate PR.
  • WASI: I got quickly into limitations with WASI 1, especially when it comes to network requests for pull/push. I have done some experimenting on the component model (WASI 2), and so I will rather revisit that when it becomes more official. Also in a separate PR then.
  • ES6 build is probably the lowest hanging fruit here, so that will come soon
  • Devcontainer setup is also straightforward, so I will separate that out

Which of these are you most interested in?

I don't know what is the best behavior either WASI or WASMFS/OPFS. Ideally the requirement is to run the git commands right from the browser's filesystem. I was hoping OPFS is the right choice as I can then use the filesystem API to access the files and then once changes are made use git command to push the changes.

All right, yes I think that also OPFS should be possible to implement now that WasmFS seems to have come quite far, and the only requirement will then be that JSPI is enabled. Soon it may also be enabled by default in the browsers. Will create a separate PR for OPFS/WasmFS soon.

petersalomonsen avatar May 07 '24 18:05 petersalomonsen