Skip to content
  • Cheng Shao's avatar
    ec1b40bd
    wasm: support running dyld fully client side in the browser · ec1b40bd
    Cheng Shao authored
    This commit refactors the wasm dyld script so that it can be used to
    load and run wasm shared libraries fully client-side in the browser
    without needing a wasm32-wasi-ghci backend:
    
    - A new `DyLDBrowserHost` class is exported, which runs in the browser
      and uses the in-memory vfs without any RPC calls. This meant to be
      used to create a `rpc` object for the fully client side use cases.
    - The exported `main` function now can be used to load user-specified
      shared libraries, and the user can use the returned `DyLD` instance
      to run their own exported Haskell functions.
    - The in-browser wasi implementation is switched to
      https://github.com/haskell-wasm/browser_wasi_shim for bugfixes and
      major performance improvements not landed upstream yet.
    - When being run by deno, it now correctly switches to non-nodejs code
      paths, so it's more convenient to test dyld logic with deno.
    
    See added comments for details, as well as the added `playground001`
    test case for an example of using it to build an in-browser Haskell
    playground.
    ec1b40bd
    wasm: support running dyld fully client side in the browser
    Cheng Shao authored
    This commit refactors the wasm dyld script so that it can be used to
    load and run wasm shared libraries fully client-side in the browser
    without needing a wasm32-wasi-ghci backend:
    
    - A new `DyLDBrowserHost` class is exported, which runs in the browser
      and uses the in-memory vfs without any RPC calls. This meant to be
      used to create a `rpc` object for the fully client side use cases.
    - The exported `main` function now can be used to load user-specified
      shared libraries, and the user can use the returned `DyLD` instance
      to run their own exported Haskell functions.
    - The in-browser wasi implementation is switched to
      https://github.com/haskell-wasm/browser_wasi_shim for bugfixes and
      major performance improvements not landed upstream yet.
    - When being run by deno, it now correctly switches to non-nodejs code
      paths, so it's more convenient to test dyld logic with deno.
    
    See added comments for details, as well as the added `playground001`
    test case for an example of using it to build an in-browser Haskell
    playground.
Loading