question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use with wasi-shim?

See original GitHub issue

I see you’ve updated to use wasi-shim, but it’s not clear how usage/configuration has changed.

  • No more need to import "wasi", right?
  • How do I correctly configure my asconfig.json?

Adding nothing results in a module that won’t execute:

Error: failed to run main module `build/debug.wasm`

Caused by:
    0: failed to instantiate "build/debug.wasm"
    1: unknown import: `env::abort` has not been defined

Following the instructions from wasi-shim results in a module that won’t compile.

ERROR TS2300: Duplicate identifier 'wasi_abort'.
      :
 1100 │ export function wasi_abort(
      │                 ~~~~~~~~~~
      └─ in ~lib/as-wasi/assembly/as-wasi.ts(1100,17)
    :
 19 │ export function wasi_abort(
    │                 ~~~~~~~~~~
    └─ in ~lib/wasi_internal.ts(19,17)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dcodeIOcommented, Nov 15, 2022

I guess ideally, both wasi-shim and as-wasi are used alongside, where wasi-shim reconfigures stdlib to use WASI APIs while as-wasi provides additional APIs that are not present in stdlib. Seems this could work well as the default, given that:

  • as-wasi depends on wasi-shim already anyway
  • Could then remove redundant APIs like
    • Console.* (wasi-shim implements std console.*)
    • Time.* (wasi-shim implements std Date.* and performance.*)
    • Environ.* (wasi-shim implements node-like process.*)
  • Whereas as-wasi can focus on additional APIs like file system access
  • Then there’s also no need to configure --use directives in as-wasi itself
0reactions
dcodeIOcommented, Nov 15, 2022

wasi-shim only overrides APIs already in AS’s stdlib, that is standard-ish JS or, where useful, Node APIs. A console.readAll with no equivalent in JS/Node should remain in as-wasi, unless it can be refactored to map to an actual JS/Node API that is first added to AS stdlib, and then overridden by wasi-shim.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WASI shim for AssemblyScript - GitHub
The AssemblyScript compiler now emits WASI-compatible modules. No more Web APIs! Migrating from 0.20. Using this shim offers almost identical ...
Read more >
Wasm3 (@wasm3_engine) / Twitter
And apparently it uses AssemblyScript + wasi-shim in a refreshing act of boldness, ... Plus: Why use a standalone WebAssembly engine in the...
Read more >
Generic loader script for C wasm : r/WebAssembly - Reddit
My work involves importing and using wasm in web applications. ... else" to compile to WASI instead of emscripten, and use the JS...
Read more >
As-wasi NPM | npm.io
Here are some exported classes that are commonly used: FileSystem - Reading and Writing the user's fileystem.; Console - General logging to stdout...
Read more >
10 Fun Facts About Grand Forks, ND
Ishim: Grand Fork's first sister city was Ishim, Tyumen Oblast, Russia. The relationship with Ishim began during the Cold War in 1984, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found