{"name":"@bjorn3/browser_wasi_shim","version":"0.2.4","author":{"name":"bjorn3"},"license":"MIT OR Apache-2.0","_id":"@bjorn3/browser_wasi_shim@0.2.4","maintainers":[{"name":"bjorn3","email":"bjorn3_gh@protonmail.com"}],"homepage":"https://github.com/bjorn3/browser_wasi_shim#readme","bugs":{"url":"https://github.com/bjorn3/browser_wasi_shim/issues"},"dist":{"shasum":"0e029f173b5f98b36ef8fa9537cdd5c10d794783","tarball":"http://registry-npm.ywwl.com/@bjorn3/browser_wasi_shim/download/@bjorn3/browser_wasi_shim-0.2.4.tgz","fileCount":12,"integrity":"sha512-2qj2PYIxYiQPPwOSEateJGTfXJ++OMwtVnlrA/oB+QKOmeJo3EytAqPZWGN/jDxINybXUQ0vvmyxy4p3lhN7WA==","signatures":[{"sig":"MEQCIFmaCDicRMm6CxIC04fYUEph4i+zLg1f7YP7b3xtxfhvAiBBeNWSPaGZgOSSzUC+OXnVLXXNw3YB8cnisiFgWqrtiA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":59962,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/g9rACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpy3A/9G6zpZ7x7CcNL491tLiC20Dmn5ibetWPmZ1I/OUdjw8D/Bhn1\r\nsnLpHyvfZvjINiM1ZaLU+yTpFCwfkV3qLq5C+E8Ss/uFdKnMXsPSMsXjxSIx\r\ngG6Myiz9N2In9j0ZMmIMcShrL4ptjW1jgAdDwj1qcTJV6C6p9xrGfbLirTv5\r\nbkmwGF0XWRb2IbyS4m6iZRfMo39Lk0aGnK/g7FBBBWJJNzmnZtKgUb60M1od\r\n9s2TdqJ0OSQsaqBozDpcrnNAh/AiyEsrGTa3XkQF0zpdtAbf+UurkIF2TaRF\r\nqgekk0/FGjnbjq3dJD/+/PNaw9qbV/oVkrjsSalBq8mXPTvrI+4MeSuO0q3f\r\nJ3uFxDbspP2m11nADViZ/BSTmLzk2zs9FY/OtQy3LdvOvoejgk8LDcVUMOQ7\r\nO6jEwnI3VQXCS6Vqxkl1x+rghGNzVABUPWFq6tWjxkMIdITKR4zygDr43VNd\r\nkyX0/0lhmoc19v4oFwf3zDoQsNb6uQcPLtIi0zKLI4MraasA8qB1bOdve/U8\r\n6ciasie6LLaF4lVxfoRB1VkAEdMCHpL/zxQp1mb6W8ZV6FDFiR3uJeRWwaBM\r\nhKQeCHIkNXGlqc6sETdUQJj7LGBATOusEZJMoW+fPHdz3YV4mqd9WTinNW/9\r\nR8tNe/OYBmYZS4RwWCWmz1TH2BLesCMbOic=\r\n=3j2V\r\n-----END PGP SIGNATURE-----\r\n","size":12949,"noattachment":false,"key":"/@bjorn3/browser_wasi_shim/-/@bjorn3/browser_wasi_shim-0.2.4.tgz"},"type":"module","exports":{".":{"import":"./src/index.js"}},"gitHead":"c21694d004fe5908c081353440d9d63fcb256dbc","scripts":{"flow":"flow"},"_npmUser":{"name":"bjorn3","email":"bjorn3_gh@protonmail.com"},"repository":{"url":"git+https://github.com/bjorn3/browser_wasi_shim.git","type":"git"},"_npmVersion":"8.19.3","description":"A pure javascript shim for WASI","directories":{},"_nodeVersion":"16.19.1","_hasShrinkwrap":false,"devDependencies":{"flow-bin":"^0.159.0"},"_npmOperationalInternal":{"tmp":"tmp/browser_wasi_shim_0.2.4_1677594474863_0.22978589915672032","host":"s3://npm-registry-packages"},"readme":"# A pure javascript shim for WASI\n\nImplementation status: A subset of wasi_snapshot_preview1 is implemented. The rest either throws an exception, returns an error or is incorrectly implemented.\n\n## Usage\n\n```\nnpm install @bjorn3/browser_wasi_shim --save\n```\n\n```javascript\nimport { WASI, File, OpenFile, ConsoleStdout, PreopenDirectory } from \"@bjorn3/browser_wasi_shim\";\n\nlet args = [\"bin\", \"arg1\", \"arg2\"];\nlet env = [\"FOO=bar\"];\nlet fds = [\n    new OpenFile(new File([])), // stdin\n    ConsoleStdout.lineBuffered(msg => console.log(`[WASI stdout] ${msg}`)),\n    ConsoleStdout.lineBuffered(msg => console.warn(`[WASI stderr] ${msg}`)),\n    new PreopenDirectory(\".\", [\n        [\"example.c\", new File(new TextEncoder(\"utf-8\").encode(`#include \"a\"`))],\n        [\"hello.rs\", new File(new TextEncoder(\"utf-8\").encode(`fn main() { println!(\"Hello World!\"); }`))],\n    ]),\n];\nlet wasi = new WASI(args, env, fds);\n\nlet wasm = await WebAssembly.compileStreaming(fetch(\"bin.wasm\"));\nlet inst = await WebAssembly.instantiate(wasm, {\n    \"wasi_snapshot_preview1\": wasi.wasiImport,\n});\nwasi.start(inst);\n```\n\n## Building\n\n```\n$ npm install\n$ npm run build\n```\n\n## Running the demo\n\nThe demo requires the wasm rustc artifacts and the xterm js package. To get them run:\n\n```\n$ git submodule update --init\n$ cd examples && npm install\n```\n\nRun the demo with a static web server from the root of this project:\n\n```\n$ npx http-server\n```\n\nAnd visit [http://127.0.0.1:8080/examples/rustc.html]() in your browser.\n\nA more complete demo by [@LyonSyonII](https://github.com/LyonSyonII) which runs\nmiri inside the browser can be found at <https://garriga.dev/rubri/>. (source\nat <https://github.com/LyonSyonII/rubri>)\n\n## Testing\n\n```\n$ python3 -m pip install -r ./test/wasi-testsuite/test-runner/requirements.txt\n$ npm test\n```\n\n## License\n\nLicensed under either of\n\n  * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n    http://www.apache.org/licenses/LICENSE-2.0)\n  * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n    http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you shall be dual licensed as above, without any\nadditional terms or conditions.\n","publish_time":1677594475065,"_cnpm_publish_time":1677594475065,"dist-tags":{"latest":"0.4.2"}}