Skip to content
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

Integration with Emscripten #117

Open
VariantXYZ opened this issue Feb 26, 2023 · 6 comments
Open

Integration with Emscripten #117

VariantXYZ opened this issue Feb 26, 2023 · 6 comments

Comments

@VariantXYZ
Copy link

I've been using isomorphic-git with lightning-fs and it's working great so far, but the next stage of my project is calling an emscripten-built assembler. Unfortunately, lightning-fs doesn't seem to implement the mount functionality emscripten expects for integration like BrowserFS.

Is it already possible to utilize lightning-fs within emscripten? If not, I think it would be really useful for lightning-fs to work with emscripten out of the box similar to BrowserFS. The full integration from Git to executing build tools all within the same file system is really appealing.

@jcubic
Copy link
Contributor

jcubic commented Feb 26, 2023

Do you want to contribute and implement this? I'm afraid if you will not do this yourself or find someone that will do this, this will never be implemented. This project is the same as isomorphic-git and it doesn't have the main author that writes all the code for free. It's community-driven, I'm a maintainer but I rarely write code myself.

@VariantXYZ
Copy link
Author

Gotcha.

Part of me was hoping it was possible and I wouldn't need to do anything, but I'll try to give it a shot. I'll close this issue for now regardless unless someone else wants to take it over.

@VariantXYZ
Copy link
Author

Actually, might make more sense to leave this open as I work on it... Kinda closed it in a rush.

So one thing I've been trying instead is seeing if I can save time by bridging lightning-fs in with the Emscripten PROXYFS layer.

Though, for some reason now I'm hitting an issue with none of the synchronous fs APIs working in Chrome...

@jcubic , do you have any idea?

My repro case is fairly straightfoward, reference this: https://github.com/VariantXYZ/LatorGit/blob/c164a5b067e0157723ea27f1d3eb7eda84f90465/index.html#L48

(Changing this line to an await pfs.lstat('/'); will work fine)

The resulting page can be seen here, I tested in Chrome 110.0.5481.178 (Official Build) (64-bit) with the disable security flag.
github-pages(1).zip

It seems to be failing here, with the callback 'cb' being null...

@VariantXYZ VariantXYZ reopened this Feb 26, 2023
@jcubic
Copy link
Contributor

jcubic commented Feb 26, 2023

Sorry I have no idea.

@VariantXYZ
Copy link
Author

Ah, actually, sorry, I fundamentally misunderstood. That fs API provided needs a callback, and the fs.promises API is asynchronous while emscripten expects entirely synchronous fs calls.

I wonder if the only reasonable path is to write up the synchronous functions manually... though I don't think this'll work great with IndexedDB.

@jcubic
Copy link
Contributor

jcubic commented Feb 26, 2023

Yes, this is a problem with Emscripten. I've even created an issue after someone asked a question on StackOverflow emscripten-core/emscripten#6115 it seems there is Asyncify now, but I'm not sure how to use it.

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

No branches or pull requests

2 participants