-
Notifications
You must be signed in to change notification settings - Fork 50
Load individual modules on demand #128
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
Load individual modules on demand #128
Conversation
I've rewritten the loader in PS. |
0f2f80b
to
1e8c6b5
Compare
I've made a few opinionated choices and improvements. The biggest change is removing backends. Since we are loading modules on demand, we don't really need to maintain separate backends for the purposes of compiling and serving a bundle. One thing that backends accomplished was setting up shims for FFI dependencies. I've added shim resolution in it's place. In the We could add other shims like big-integer or whatever if we want to support other libraries with FFI dependencies. The other thing backends do is setup a I've also fully sandboxed the iframe. Though which libraries are available is still vetted, this pulls in arbitrary JS. A fully sandboxed iframe means session information can't leak out of it it since it has a unique origin. This is done through |
I've simplified the FFI shims. They are just loaded from I'm pretty happy with this so far. @paf31 what do you think about this? There are a few things to consider:
|
I like the approach, and especially being able to do away with backends. I think starting by serving a compiled output directory as static files sounds good. I think just getting something working should be the focus for now; we can worry about optimisation later I think. @gabejohnson would you like to have a go at taking the contents of this PR and applying them to master? |
Sure thing! I can take a look at it over the weekend. |
Resolved by #136 |
Runtime JS dependencies are obtained as follows: - dependencies for the main client window (eg jquery, ace) are obtained via cdnjs.cloudflare.com, and so we don't need anything beyond than the script tags in index.html. - dependencies needed inside the iframe (eg react, for gists which use react-based libraries like purescript-react or purescript-thermite) are obtained via the new 'shims' mechanism introduced by #128 / #136. The files I am removing in this commit do not appear to be in use. I've also removed non-purescript dependencies from bower.json, as they also do not appear to be in use.
Runtime JS dependencies are obtained as follows: - dependencies for the main client window (eg jquery, ace) are obtained via cdnjs.cloudflare.com, and so we don't need anything beyond than the script tags in index.html. - dependencies needed inside the iframe (eg react, for gists which use react-based libraries like purescript-react or purescript-thermite) are obtained via the new 'shims' mechanism introduced by #128 / #136. The files I am removing in this commit do not appear to be in use. I've also removed non-purescript dependencies from bower.json, as they also do not appear to be in use.
Rather than serving and loading a giant bundle. Depends on #127
I can rewrite the module fetch in PS, but I thought I'd go ahead and throw this out there. The expectation is that you'd serve the psci output folder. This includes a barebones require shim which loads modules on demand. Perhaps we could host more libraries in that case without having to resort to different backends.