Wasm support#708
Conversation
03f1e81 to
1486cdb
Compare
|
@dfordivam Does this obviate #702 ? |
Yes, and #689 also |
| , _backendConfig_staticAssets :: !StaticAssets -- ^ Static assets | ||
| , _backendConfig_ghcjsWidgets :: !(GhcjsWidgets (Text -> FrontendWidgetT (R frontendRoute) ())) | ||
| -- ^ Given the URL of all.js, return the widgets which are responsible for | ||
| , _backendConfig_ghcjsAssets :: !StaticAssets -- ^ Frontend ghcjs (and wasm) assets |
There was a problem hiding this comment.
We should rename this but it can be in a different PR.
| shells-ghc = builtins.attrNames (self.predefinedPackages // self.shellPackages); | ||
|
|
||
| shells-ghcjs = [ | ||
| shells-frontend = [ |
There was a problem hiding this comment.
Ryan pointed out that it's possible to have a ghc frontend so my suggestion of shells-frontend isn't quite right. Maybe shells-web?
| \}" | ||
|
|
||
| delayedJsScript n = | ||
| "var wasmFile = " <> wasmUrl <> ";\ |
There was a problem hiding this comment.
var WASM_APP_URL or something and even a comment explaining what it's for.
There was a problem hiding this comment.
There's enough "logic" in these drivers that it makes me want to templatize them so we only have to express the meaningful bits once.
| \var tag = document.createElement('script');\ | ||
| \tag.type = 'text/javascript';\ | ||
| \tag.src = docSrc;\ | ||
| \tag.setAttribute = ('defer', 'defer');\ |
There was a problem hiding this comment.
I fear for backwards compatibility on this syntax. Let's stick with the function call.
| \tag.setAttribute = ('defer', 'defer');\ | |
| \tag.setAttribute('defer', 'defer');\ |
| -- ^ (preload script, deferred run script, delayed run script (Int input is the delay)) | ||
| wasmScripts allJsUrl' (wasmRoot, wAssets) = (preloadScript, runJsScript, delayedJsScript) | ||
| where | ||
| wrapName f = "'" <> wasmRoot <> "/" <> f wAssets <> "'" |
There was a problem hiding this comment.
Since this stuff is user-supplied we should do at least basic sanitizing on it. Maybe replacing ' with \' at least.
There was a problem hiding this comment.
Isn't there some library (jmacro?) that actually knows how to do this properly? We should not be implementing escaping ourselves, and we certainly shouldn't be doing it inline in other code.
c33fb9b to
2ff139a
Compare
2ff139a to
4534a5b
Compare
|
Just a quick question: any idea if this is going to be merged anytime soon? |
|
@bidigo this will take a while. It needs more testing and performance improvements. There is a more recent work done on this branch https://github.com/obsidiansystems/obelisk/tree/dn-jsaddle-core2-2-wasm |
|
@dfordivam Thx for the info (and thanks for the great work!) |
Cleaned up (rebased) the work done for wasm support.
The feature is working fine now,
though there are still nix related things to be fixed, especially in reflex-platform.I have:
developbranchhlint .(lint found code you did not write can be left alone)$(nix-build -A selftest --no-out-link)nix-build release.nix -A build.x86_64-linux --no-out-link(orx86_64-darwinon macOS)